<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  <meta name="keywords" content="admin, dashboard, bootstrap, template, flat, modern, theme, responsive, fluid, retina, backend, html5, css, css3">
  <meta name="description" content="">
  <meta name="author" content="ThemeBucket">
  <link rel="shortcut icon" href="#" type="image/png">

  <title>企业管理系统 </title>

  <!--icheck-->
  <link href="js/iCheck/skins/minimal/minimal.css" rel="stylesheet">
  <link href="js/iCheck/skins/square/square.css" rel="stylesheet">
  <link href="js/iCheck/skins/square/red.css" rel="stylesheet">
  <link href="js/iCheck/skins/square/blue.css" rel="stylesheet">

  <!--dashboard calendar-->
  <link href="css/clndr.css" rel="stylesheet">

  <!--Morris Chart CSS -->
  <link rel="stylesheet" href="js/morris-chart/morris.css">

  <!--common-->
  <link href="css/style.css" rel="stylesheet">
  <link href="css/style-responsive.css" rel="stylesheet">




  <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!--[if lt IE 9]>
  <script src="js/html5shiv.js"></script>
  <script src="js/respond.min.js"></script>
  <![endif]-->
</head>

<body class="sticky-header">

<section>
    <!-- left side start-->
    <script src="left.js"></script>

    <!-- left side end-->
    
    <!-- main content start-->
    <div class="main-content" >

        <!-- header section start-->
        <div class="header-section">

            <!--toggle button start-->
            <a class="toggle-btn"><i class="fa fa-bars"></i></a>
            <!--toggle button end-->


        </div>
        <!-- header section end-->

        <!-- page heading start-->
        <div class="page-heading">
            <h3>
                首页
            </h3>

<!--            <div class="state-info">-->

<!--                <section class="panel">-->
<!--                    <div class="panel-body">-->
<!--                        <div class="summary">-->
<!--                            <span>昨日交易量</span>-->
<!--                            <h3 class="green-txt">$ 45,600</h3>-->
<!--                        </div>-->
<!--                        <div id="expense" class="chart-bar"></div>-->
<!--                    </div>-->
<!--                </section>-->
<!--            </div>-->
        </div>
        <!-- page heading end-->

        <!--body wrapper start-->
        <div class="wrapper">
            <div class="row">
                <div class="col-md-6">
                    <!--statistics start-->
                    <div class="row state-overview">
                        <div class="col-md-6 col-xs-12 col-sm-6">
                            <div class="panel purple">
                                <div class="symbol">
                                    <i class="fa fa-gavel"></i>
                                </div>
                                <div class="state-value">
                                    <div class="value">便签</div>
                                    <div class="title">

                                        <div id="bianqian">

                                        </div><br>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 col-xs-12 col-sm-6">
                            <div class="panel red">
                                <div class="symbol">
                                    <i class="fa fa-tags"></i>
                                </div>
                                <div class="state-value">
                                    <div class="value">保养提醒</div>
                                    <div class="title">
                                        <br>
                                    <span id="danger_baoyang">xxx</span>
                                        <br>该保养了<br>
                                        <a href="g_huopin.html">去保养</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 col-xs-12 col-sm-6">
                            <div class="panel green">
                                <div class="symbol">
                                    <i class="fa fa-tags"></i>
                                </div>
                                <div class="state-value">
                                    <div class="value">考勤</div>
                                    <div class="title">

                                    <button onclick="qiandao()" value="" style="background-color: #1CAF9A">签到</button>

                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 col-xs-12 col-sm-6">
                            <div class="panel red">
                                <div class="symbol">
                                    <i class="fa fa-tags"></i>
                                </div>
                                <div class="state-value">
                                    <div class="value">库存预警</div>
                                    <div class="title">
                                    <br>
                                        <span id="danger_kucun">xxx</span><br>
                                        该补货了<br>
                                        <a href="g_huopin.html">去补货</a>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                    <!--statistics end-->
                </div>
                <div class="col-md-6">
                    <!--more statistics box start-->
                    <div class="panel deep-purple-box">
                        <div class="panel-body" >
                            <div class="value"><h3>公告</h3></div>
                            <div id="gonggao"></div>

                        </div>
                    </div>
                    <div class="panel deep-purple-box">
                        <div class="panel-body" >
                            <div class="value" ><h3>需要干的事</h3></div>
                            <div id="needtodo"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


        <div class="row">
                <div class="col-md-4">
                    <div class="panel">
                        <div class="panel-body">
                            <div class="calendar-block ">
                                <div class="cal1">

                                </div>
                            </div>

                        </div>
                    </div>
                </div>

            <div class="col-md-4">
                <div class="panel">
                    <header class="panel-heading">
                        工作量日榜
                        <span class="tools pull-right">
                                <a href="javascript:;" class="fa fa-chevron-down"></a>
                                <a href="javascript:;" class="fa fa-times"></a>
                             </span>
                    </header>
                    <div class="panel-body">
                        <ul class="goal-progress" id="paihangList">
                            <li>
                                <div class="prog-avatar">
                                    <img src="images/photos/user1.png" alt=""/>
                                </div>
                                <div class="details">
                                    <div class="title">
                                       <span>老张</span>
                                    </div>
                                    <div class="progress progress-xs">
                                        <span style="color: red">500单</span>
                                    </div>
                                </div>
                            </li>
                        </ul>

                    </div>
                </div>
            </div>
        </div>

    </div>
        </div>
        <!--body wrapper end-->

        <!--footer section start-->
        <footer>
            2020 &copy; AdminEx by ThemeBucket </a>
        </footer>
        <!--footer section end-->


    </div>
    <!-- main content end-->
</section>
<!--初始化权限-->
<script src="orders.js"></script>
<script>
    function showPaiHang(list){
        $('#paihangList').empty();
        for(var i=0;i<list.length;i++) {
            var li="<li>\n" +
                "                                <div class=\"prog-avatar\">\n" +
                "                                    <img src=\"images/photos/user1.png\" alt=\"\"/>\n" +
                "                                </div>\n" +
                "                                <div class=\"details\">\n" +
                "                                    <div class=\"title\">\n" +
                "                                       <span>"+list[i].sysUser.name+"</span>\n" +
                "                                    </div>\n" +
                "                                    <div class=\"progress progress-xs\">\n" +
                "                                        <span style=\"color: red\">"+list[i].attend.workNums+"单</span>\n" +
                "                                    </div>\n" +
                "                                </div>\n" +
                "                            </li>"
            console.log(li)
            $("#paihangList").append(li);
        }
    }

    function qiandao(){//签到
        $.ajax({
            url:"/attend/start",
            type:"get",
            contentType:"application/json;charset=UTF8",
            dataType:"json",
            success:function (res){
                alert(res.msg)
            },
            error:function (){

            }
        })
    }

    function showIndex(indexBox){

        $("#bianqian").html(indexBox.tagHtml)
        $("#needtodo").html(indexBox.msgHtml)
        $("#gonggao").html(indexBox.noticeHtml)

    }

    function getName(list){
        var o = [];
        var a=list
        $.each(a, function () {
            o.push(this.name+" ")
        });
        return o;
    }
    window.onload=function (){
        //初始化权限
        var order;
        $.ajax({
            url:"/users/getOrder",
            type:"get",
            contentType:"application/json;charset=UTF8",
            dataType:"json",
            success:function (res){
                order=res;
                if(order==2){
                    order2();
                }
                if(order==3){
                    order3();
                }
            },
            error:function (){

            }
        })

        //加载货物预警信息
        $.ajax({
            url:"/huopin/getDanger",
            type:"get",
            contentType:"application/json;charset=UTF8",
            dataType:"json",
            success:function (res){
                var  kucun= getName(res.data.dangerSum);
                var baoyang=getName(res.data.dangerTime);
                console.log(baoyang)
                console.log(kucun)
                $("#danger_baoyang").html(baoyang)
                $("#danger_kucun").html(kucun)
            },
            error:function (){

            }
        })

        //加载干活量日排行榜
        $.ajax({
            url:"/attend/getPaihang",
            type:"get",
            contentType:"application/json;charset=UTF8",
            dataType:"json",
            success:function (res){
                var ulList=res.data;
                showPaiHang(ulList);
            },
            error:function (){

            }
        })


        //加载首页各类展示信息
        $.ajax({
            url:"/index/getMsg/1",
            type:"get",
            contentType:"application/json;charset=UTF8",
            dataType:"json",
            success:function (res){
                if(!res.success){
                    alert(res.msg)
                }
                var indexBox=res.data;
                showIndex(indexBox);
            },
            error:function (){

            }
        })
    }
</script>
<!--初始化权限-->

<!-- Placed js at the end of the document so the pages load faster -->
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="js/jquery-migrate-1.2.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/modernizr.min.js"></script>
<script src="js/jquery.nicescroll.js"></script>

<!--easy pie chart-->
<script src="js/easypiechart/jquery.easypiechart.js"></script>
<script src="js/easypiechart/easypiechart-init.js"></script>

<!--Sparkline Chart-->
<script src="js/sparkline/jquery.sparkline.js"></script>
<script src="js/sparkline/sparkline-init.js"></script>

<!--icheck -->
<script src="js/iCheck/jquery.icheck.js"></script>
<script src="js/icheck-init.js"></script>

<!-- jQuery Flot Chart-->
<script src="js/flot-chart/jquery.flot.js"></script>
<script src="js/flot-chart/jquery.flot.tooltip.js"></script>
<script src="js/flot-chart/jquery.flot.resize.js"></script>


<!--Morris Chart-->
<script src="js/morris-chart/morris.js"></script>
<script src="js/morris-chart/raphael-min.js"></script>

<!--Calendar-->
<script src="js/calendar/clndr.js"></script>
<script src="js/calendar/evnt.calendar.init.js"></script>
<script src="js/calendar/moment-2.2.1.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>

<!--common scripts for all pages-->
<script src="js/scripts.js"></script>

<!--Dashboard Charts-->
<script src="js/dashboard-chart-init.js"></script>


</body>
</html>
